package com.jch.ft.server;

import com.jch.ft.codec.ObjectDecoder;
import com.jch.ft.codec.ObjectEncoder;
import com.jch.ft.domain.FileTransferProtocol;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;

// 编排handler
public class ServerChannelInitializer extends ChannelInitializer<SocketChannel> {

    @Override
    protected void initChannel(SocketChannel ch) throws Exception {
        ch.pipeline().addLast(new ObjectDecoder(FileTransferProtocol.class));
        ch.pipeline().addLast(new ObjectEncoder(FileTransferProtocol.class));

        ch.pipeline().addLast(new ServerFileTransferHandler());
    }
}
